package com.ruoyi.labour.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.labour.domain.vo.PageVo;
import com.ruoyi.labour.domain.vo.UpdateCustomerPhoneVo;
import com.ruoyi.labour.service.CustomerPhoneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: ServicePhoneController
 * @Description:
 * @Author: Awen
 * @Date: 2023/5/15 11:24
 */
@RestController
@RequestMapping("/customerPhone")
@Api(tags = "客服管理")
public class CustomerPhoneController {

    @Autowired
    private CustomerPhoneService customerPhoneService;

    /**
     * 添加热线电话
     * @param phone
     * @return
     */
    @ApiOperation("添加热线电话")
    @GetMapping("/addCustomerPhone/{phone}")
    public R addCustomerPhone(@PathVariable String phone){
        return customerPhoneService.addCustomerPhone(phone);
    }

    /**
     * 查询热线电话
     * @param pageVo
     * @return
     */
    @ApiOperation("查询热线电话")
    @PostMapping("/selectCustomerPhone")
    public R selectCustomerPhone(@RequestBody PageVo pageVo){
        return customerPhoneService.selectCustomerPhone(pageVo);
    }

    /**
     * 删除热线电话
     * @param id
     * @return
     */
    @ApiOperation("删除热线电话")
    @GetMapping("/deleteCustomerPhone/{id}")
    public R deleteCustomerPhone(@PathVariable Integer id){
        return customerPhoneService.deleteCustomerPhone(id);
    }

    /**
     * 修改热线电话可用状态
     * @param state
     * @param id
     * @return
     */
    @ApiOperation("修改热线电话可用状态")
    @GetMapping("/updateCustomerPhoneState/{state}/{id}")
    public R updateCustomerPhoneState(@PathVariable Integer state,@PathVariable Integer id){
        return customerPhoneService.updateCustomerPhoneState(state,id);
    }

    /**
     * 修改热线电话
     * @param updateCustomerPhoneVo
     * @return
     */
    @ApiOperation("修改热线电话")
    @PostMapping("/updateCustomerPhone")
    public R updateCustomerPhone(@RequestBody UpdateCustomerPhoneVo updateCustomerPhoneVo){
        return customerPhoneService.updateCustomerPhone(updateCustomerPhoneVo);
    }



}
